package main

func main() {
	//4294967295
	println(toHex(0))
}
func toHex(num int) (res string) {
	m := map[int]uint8{}
	m[0] = '0'
	m[1] = '1'
	m[2] = '2'
	m[3] = '3'
	m[4] = '4'
	m[5] = '5'
	m[6] = '6'
	m[7] = '7'
	m[8] = '8'
	m[9] = '9'
	m[10] = 'a'
	m[11] = 'b'
	m[12] = 'c'
	m[13] = 'd'
	m[14] = 'e'
	m[15] = 'f'

	if num > 0 {
		for num != 0 {
			rem := num % 16
			res = string(m[rem]) + res
			num /= 16
		}
		return
	} else if num == 0 {
		res = string(m[num])
	}
	num &= 4294967295
	for num != 0 {
		rem := num % 16
		res = string(m[rem]) + res
		num /= 16
	}
	return
}
